<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('配置盟主引流特别奖励')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-bounty-add" th:with="type=${@dict.getType('special_bounty_gear')}">
            <div th:each="dict : ${type}">
                <fieldset>
                    <legend th:text="${dict.dictLabel}"></legend>
                    <input th:name="'id'+ ${dict.dictValue}" th:each="item,sb:${specialBountys}" th:if="${sb.current.key=='id'+dict.dictValue}" th:value="${sb.current.value}" type="hidden" required>
                    <input th:name="'gear'+ ${dict.dictValue}" th:value="${dict.dictValue}" type="hidden" required>
                    <div class="col-md-5">
                        <div class="form-group">
                            <label class="col-sm-5 control-label is-required">首次购机数量：</label>
                            <div class="col-sm-6" th:each="item,sb:${specialBountys}" th:if="${sb.current.key=='numbers'+dict.dictValue}">
                                <input th:name="'numbers' + ${dict.dictValue}" th:value="${sb.current.value}" class="form-control" type="text" required  >
                            </div>
                            <div class="col-sm-6"  th:if="${flag=='0'}">
                                <input th:name="'numbers' + ${dict.dictValue}" value="" class="form-control" type="text" required  >
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-5 control-label is-required">奖励期限(显示)：</label>
                            <div class="col-sm-6" th:each="item,sb:${specialBountys}" th:if="${sb.current.key=='bountyMonthShow'+dict.dictValue}">
                                <input th:name="'bountyMonthShow'+ ${dict.dictValue}" class="form-control" th:value="${sb.current.value}"  type="text" min="0" required>
                            </div>
                            <div class="col-sm-6"  th:if="${flag=='0'}">
                                <input th:name="'bountyMonthShow' + ${dict.dictValue}" value="" class="form-control" type="text" required  >
                            </div>
                        </div>
                    </div>
                    <div class="col-md-5">
                        <div class="form-group">
                            <label class="col-sm-5 control-label is-required">引流奖励：</label>
                            <div class="col-sm-6" th:each="item,sb:${specialBountys}" th:if="${sb.current.key=='sumMoney'+dict.dictValue}">
                                <input th:name="'sumMoney'+ ${dict.dictValue}" class="form-control" th:value="${sb.current.value}"  type="text" required>
                            </div>
                            <div class="col-sm-6"  th:if="${flag=='0'}">
                                <input th:name="'sumMoney' + ${dict.dictValue}" value="" class="form-control" type="text" required  >
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-5 control-label is-required">奖励期限(隐藏)：</label>
                            <div class="col-sm-6" th:each="item,sb:${specialBountys}" th:if="${sb.current.key=='bountyMonthHide'+dict.dictValue}">
                                <input th:name="'bountyMonthHide'+ ${dict.dictValue}" class="form-control" th:value="${sb.current.value}"  type="text" min="0" required>
                            </div>
                            <div class="col-sm-6"  th:if="${flag=='0'}">
                                <input th:name="'bountyMonthHide' + ${dict.dictValue}" value="" class="form-control" type="text" required  >
                            </div>
                        </div>
                    </div>
                    <div class="col-md-3">

                    </div>
                    <div class="col-md-3">

                    </div>
                </fieldset>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "bounty/bounty";
        var specialBountyGear = [[${@dict.getType('special_bounty_gear')}]];
        var rules = new Object();
        $(specialBountyGear).each(function (index, dict) {
            var numbers = new Object();
            numbers.required = true;
            numbers.digits=true;
            numbers.min=1;
            rules['numbers'+dict.dictValue] = numbers;
            var sumMoney = new Object();
            sumMoney.required = true;
            sumMoney.number=true;
            sumMoney.min=0;
            rules['sumMoney'+dict.dictValue] = sumMoney;
            var bountyMonthShow = new Object();
            bountyMonthShow.required = true;
            bountyMonthShow.digits=true;
            bountyMonthShow.min=0;
            rules['bountyMonthShow'+dict.dictValue] = bountyMonthShow;
            var bountyMonthHide = new Object();
            bountyMonthHide.required = true;
            bountyMonthHide.digits=true;
            bountyMonthHide.min=0;
            rules['bountyMonthHide'+dict.dictValue] = bountyMonthHide;
        });
        $("#form-bounty-add").validate({
            rules:rules,
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-bounty-add').serialize());
            }
        }
    </script>
</body>
</html>